Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 check accuracy of TypeReferenceMatch & MethodReferenceMatch #91

Merged
merged 3 commits into from
Mar 28, 2024

Conversation

pranavgaikwad
Copy link
Contributor

@pranavgaikwad pranavgaikwad commented Mar 27, 2024

This removes accuracy checks that depend on errors in the project.

I observed that most inaccurate matches we get are from TypeReferenceMatch matches, this is because they do not take into account fully qualified names of types.

There is also some instances of inaccurate stuff coming from method calls, this fixes the search pattern to be fully qualified instead of all references.

Signed-off-by: Pranav Gaikwad <[email protected]>

:update:

Signed-off-by: Pranav Gaikwad <[email protected]>
@pranavgaikwad pranavgaikwad marked this pull request as draft March 27, 2024 20:26
@pranavgaikwad pranavgaikwad changed the title 🐛 check accuracy of TypeReferenceMatch 🐛 check accuracy of TypeReferenceMatch & MethodReferenceMatch Mar 28, 2024
@pranavgaikwad pranavgaikwad marked this pull request as ready for review March 28, 2024 11:37
var element = (IJavaElement) match.getElement();
ICompilationUnit compilationUnit = (ICompilationUnit) element
.getAncestor(IJavaElement.COMPILATION_UNIT);
if (compilationUnit == null) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just for my own understanding when does this happen?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I understood it correctly, this happens when match is in a .class file. In that case, the compilation unit needs to be loaded into memory. Fortunately, the class file doesn't need to be decompiled....we can somehow get imports, package declaration, methods etc just from the class file handle

Copy link
Contributor

@shawn-hurley shawn-hurley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes a ton of sense and is probably a much better approach to calculating accuracy.

I wonder if we are going to have to something similar for Annotations, IIRC that is the only one that was causing issues

Copy link
Member

@aufi aufi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Signed-off-by: Pranav Gaikwad <[email protected]>
@pranavgaikwad
Copy link
Contributor Author

I will do a similar thing for annotations too when I get the time, this addresses most of the test failures. I will get back to it after I am done with testing stuff. tracking it here #92

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants